package com.vr.cloudpicture.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.vr.cloudpicture.api.aliyunoutpicture.model.CreateOutPaintingTaskResponse;
import com.vr.cloudpicture.common.PageResult;
import com.vr.cloudpicture.model.dto.DeleteRequest;
import com.vr.cloudpicture.model.dto.picture.*;
import com.vr.cloudpicture.model.entity.Picture;
import com.vr.cloudpicture.model.vo.PictureVO;
import com.vr.cloudpicture.model.dto.user.UserLogin;
import org.springframework.scheduling.annotation.Async;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author hzh
* @description 针对表【picture(图片)】的数据库操作Service
* @createDate 2025-05-07 16:24:42
*/
public interface IPictureService extends IService<Picture> {


    /**
     * 上传图片
     *
     * @param inputSource        输入源
     * @param pictureUploadRequest 图片上传请求
     * @param loginUser            登录用户
     * @return {@code PictureVO }
     */
    PictureVO uploadPicture(Object inputSource, PictureUploadRequest pictureUploadRequest, UserLogin loginUser) ;

    /**
     * 获取图片 通过id获取图片信息(封装的)
     *
     * @param id      id
     * @param request 请求
     * @return {@code PictureVO }
     */
    PictureVO getPictureVOById(Long id,HttpServletRequest request);


    /**
     * 分页查询获取图片列表,仅管理员可用
     *
     * @param pictureQueryRequest 图片查询请求
     * @return {@code PageResult<Picture> }
     */
    PageResult<Picture> listPictureByPage(PictureQueryRequest pictureQueryRequest);

    /**
     * 分页查询获取图片列表，仅管理员可用
     *
     * @param pictureQueryRequest 图片查询请求
     * @param request             请求
     * @return {@code PageResult<PictureVO> }
     */
    PageResult<PictureVO> listPictureVOByPage(PictureQueryRequest pictureQueryRequest,HttpServletRequest request);

    /**
     * 编辑图片,用户用的
     *
     * @param pictureEditRequest 图片编辑请求参数
     * @param request             请求
     * @return {@code Boolean }
     */
    Boolean editPicture(PictureEditRequest pictureEditRequest, HttpServletRequest request);

    /**
     * 删除图片
     *
     * @param deleteRequest 删除请求参数
     * @param request              请求
     * @return {@code Boolean }
     */
    Boolean deletePicture(DeleteRequest deleteRequest, HttpServletRequest request);

    /**
     * 更新图片，管理员用的
     *
     * @param pictureUpdateRequest 图片更新请求参数
     * @param request              请求
     * @return {@code Boolean }
     */
    Boolean updatePicture(PictureUpdateRequest pictureUpdateRequest, HttpServletRequest request);

    /**
     * 审核图片
     *
     * @param pictureReviewRequest 图片审核请求
     * @param request              请求
     * @return {@code Boolean }
     */
    Boolean reviewPicture(PictureReviewRequest pictureReviewRequest, HttpServletRequest request);

    /**
     * 填写审核参数
     *
     * @param picture   带填充图片信息
     * @param loginUser 登录用户
     */
    void fillReviewParams(Picture picture, UserLogin loginUser);

    /**
     * 批量抓取图片上传请求
     *
     * @param pictureUploadByBatchRequest 批量抓取图片上传请求参数
     * @param loginUser                   登录用户
     * @return {@code Integer }
     */
    Integer uploadPictureByBatch(PictureUploadByBatchRequest pictureUploadByBatchRequest, UserLogin loginUser);


    /**
     * 清除图片文件
     *
     * @param picture 图片
     */
    @Async
    void clearPictureFile(Picture picture);


    /**
     * 检查图片权限
     *
     * @param loginUser 登录用户
     * @param picture   图片
     */
    void checkPictureAuth(UserLogin loginUser, Picture picture);

    /**
     * 按颜色搜索图片
     *
     * @param searchPictureByColorRequest 按颜色请求搜索图片
     * @param loginUser 登录用户
     * @return {@code List<PictureVO> }
     */
    List<PictureVO> searchPictureByColor(SearchPictureByColorRequest searchPictureByColorRequest, UserLogin loginUser);

    /**
     * 批量编辑图片
     *
     * @param pictureEditByBatchRequest 通过批量请求编辑图片
     * @param loginUser                 登录用户
     * @return {@code Boolean }
     */
    Boolean editPictureByBatch(PictureEditByBatchRequest pictureEditByBatchRequest, UserLogin loginUser);

    /**
     * 创建AI扩图任务
     *
     * @param createPictureOutPaintingRequest Create Picture Out Painting 请求
     * @param loginUser                       登录用户
     * @return {@code CreateOutPaintingTaskResponse }
     */
    CreateOutPaintingTaskResponse createPictureOutPaintingTask(CreatePictureOutPaintingRequest createPictureOutPaintingRequest, UserLogin loginUser);

}
